home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1997-07-10 | 8.7 KB | 183 lines | [ TEXT/CWIE]
(************************************************************************* ** Apple Macintosh Developer Technical Support ** ** SimpleApp Framework: A Copland Savvy Application Framework. ** ** by Matthew Xavier Mora, Apple Developer Technical Support ** ** File: SimpleAppIntf.p ** ** Copyright © 1995-1996 Apple Computer, Inc. ** All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction, though the sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. However, what you are ** not permitted to do is to redistribute the source as "DSC Sample Code" ** after having made changes. If you're going to re-distribute the source, ** we require that you make it clear in the source that the code was ** descended from Apple Sample Code, but that you've made changes. ** **************************************************************************) unit SimpleAppIntf; interface uses GestaltEqu, ToolUtils,Fonts,Lists, DiskInit, Devices,AppleScript, SimpleAppGlobals,Resources, palettes; const kErrorBase = 0 ; { Base value for ErrorNumbers} kSAStandardDebugAlert = 9999; kSANonFatalError = 0; kSAFatalError = kErrorBase - 1 ; kSABadSelectorErr = kErrorBase - 2 ; kSABadProcPtr = kErrorBase - 3 ; kNotOurWindowError = kErrorBase - 4 ; kNotValidObject = kErrorBase - 5 ; function SALockHandle (hand: univ Ptr): SInt8; procedure SAUnlockHandle (hand: univ Ptr; state: SInt8); function GetDialogWindow (resID: integer;ditlResID:integer): integer; function SAExecuteScript(resID:integer):integer; procedure ErrorMessage(msg:Str255;error:longint;flags:integer); procedure SAMoveObject (orh:ObjectRef;h,v:integer;reDraw:Boolean); procedure SADrawGroup( grh:GroupRecHandle;update:RgnHandle); procedure InitSimpleApp (masters: integer; wantsStandardMenu: Boolean); procedure InitFBSimpleApp (masters: integer; stackSize: longint); procedure SAInitCursor; procedure InstallAboutProc(ap:AboutProc); procedure Run; procedure CloseSimpleApp; procedure SADoWindowClose(var theWindow:WindowRef); function DefaultMenuHit (modifiers: longint): integer; function InstallMenuItem (menuID: integer;MenuItem: integer;var menuTitle: Str255;mark: UInt8;cmdUInt8: UInt8;menuHit: MenuHitProc; menuUpdate: MenuUpdateProc): integer; function InstallEditField (var editID : longint; window : WindowRef ; var name : Str255 ; var r: Rect ; hitProc:EditFieldHitProc ; updateProc: EditFieldUpdateProc ; keyProc : ObjectKeyProc;flags : longint): integer; function InstallList (var theListID: longint; window: WindowRef; cellSize:Point; var r: Rect;{} lhp: ListHitProc; ltp: ListTrackProc; lup: ListUpdateProc; ldcp: ListDrawCellProc; flags: longint): integer; procedure InstallIdleProc (ip: EventProcs); function InstallPushButton (var buttonID: longint; window: WindowRef;var name: Str255;var r: Rect;cmdKey: UInt8;bhp: ButtonHitProc;bup: ButtonUpdateProc): integer; function InstallCheckBox(var buttonID: longint;window: WindowRef;var name: Str255;var r: Rect;cmdKey: UInt8;initialValue:integer;bhp: ButtonHitProc;bup: ButtonUpdateProc ): integer; function InstallPopUp(var buttonID: longint;window: WindowRef;var name: Str255;var r: Rect;options,styles:integer;MenuID:integer;resID:OSType;bhp: ButtonHitProc;bup: ButtonUpdateProc ): integer; procedure SAInitScripting; function SADoNew:OSErr; function CreateDocumentWindow (var name: Str255; var bounds: Rect; visable: Boolean): integer; function GetDocumentWindow (resID: integer): integer; procedure Print (s: Str255); {Print no CR} procedure PrintLine (s: Str255); {Print with CR} procedure PrintTextHandle (text: Handle); {Print a buffer full of text with CR} procedure SetRectLocation (var r: Rect; h, v: integer); {This Sets a rects anchor point} procedure SetRectDimensions (var r: Rect; h, v: integer); {This Sets its size without changing its position} procedure GetPrintArea (window: WindowRef; var bounds: Rect); procedure SetPrintArea (window: WindowRef; var bounds: Rect); function SAGetEditField (wind:WindowRef;editID:integer): EditFieldItemRecHandle; procedure SASetFocus (theWindow: WindowRef; efrh:EditFieldItemRecHandle); function GetTEString (editFieldID: longint; var s: Str255): integer; function AddStringToList (listID: ListRef; var s: Str255): OSErr; procedure BlastString (h, v: integer; s: Str255); {These will blast text at the location specified. It erases as it draws} procedure BlastText (h, v: integer; text: Handle); procedure SetMyTitle (title: Str255); procedure SADisableMe; procedure SAEnableMe; procedure SADisableObject(thing:longint); procedure SAEnableObject(thing:longint); function SAGetGroupItem(wind:WindowRef;groupID:integer;item:integer):ButtonItemRecHandle; function SADrawObject(orh:ObjectRef;update:RgnHandle):integer; function SAPPCBrowser(var theLocationNameRec: LocationNameRec; var thePortInfoRec: PortInfoRec): OSErr; function SAPPCStart(thePortInfoPtr: PortInfoPtr; theLocationNamePtr: LocationNamePtr;thePortRefNum: PPCPortRefNum; VAR theSessRefNum: PPCSessRefNum;VAR theUserRefNum: LongInt; VAR theRejectInfo: LongInt): OSErr; function SAPPCOpen(VAR thePortRefNum: PPCPortRefNum;var thePPCPortRec: PPCPortRec; var theLocationNameRec: LocationNameRec; var nbpRegisteredFlag: Boolean): OSErr; function InstallCustomObject (var objectID: longint; window: WindowRef; var name: Str255; var r: Rect; cmdKey: UInt8; oip: ObjectInitProc; odp: ObjectDisposeProc; ohp: ObjectHitProc; otp: ObjectTrackProc; oup: ObjectUpdateProc; refCon:longint):integer; function InstallControl (var buttonID: longint;window: WindowRef;var name: Str255;var r: Rect;cmdKey: UInt8;controlType:integer; bhp: ButtonHitProc;bup: ButtonUpdateProc): integer; function InstallRadioGroup (var theGroupID: longint; window: WindowRef; count:integer; var title:Str255; names:StringArrayPtr; var r: Rect; defaultItem:integer; hSpacing:integer ; vSpacing:integer ; buttonHeight:integer; buttonWidth:integer; PreGHP: PreGroupHitProc; PostGHP: PostGroupHitProc; gup: GroupUpdateProc): integer; function InstallStaticText(var textID:longint; window: WindowRef; var text: Str255; var r: Rect):integer; function InstallScrollBar (var buttonID: longint; window: WindowRef; var name: Str255; var r: Rect; cmdKey: UInt8; scrollHitProc: MyActionProc; scrollButtonProc: MyActionProc; scrollIndicatorProc: MyActionProc): integer; function ValidWindow (w: WindowRef; var wirh: WindowItemRecHandle): boolean; procedure SetIdleProc (ep: EventProcs); function SASetObjectIdleProc(orh:ObjectRef;idle:ObjectIdleProc):integer; procedure InstallPreEventHandler (eventHandler:PreEventProc;refCon:longint); procedure InstallObjectEditProcs (newEditProc:ObjectEditProc;owner:ObjectRef); function SAGetObjectHandle(thing:longint):Handle; procedure SetWindowHitProc (window:WindowRef;theProc: WindowHitProc); procedure SetWindowUpdateProc (window:WindowRef;theProc: WindowUpdateProc); procedure SetWindowIdleProc (window:WindowRef;theProc: WindowIdleProc); procedure SetWindowGrowProc (window:WindowRef;theProc: WindowGrowProc); procedure SetWindowActivateProc (window:WindowRef;theProc: WindowActivateProc); procedure SetWindowCloseProc (window:WindowRef;theProc:WindowCloseProc); function GetWindowCloseProc (window:WindowRef):WindowCloseProc; procedure SetWindowZoomProc (window:WindowRef;theProc:WindowZoomProc); procedure SetWindowFSSpec (window:WindowRef;var theFSSpec: FSSpec); function GetWindowFSSpec (window:WindowRef;var theFSSpec: FSSpec):OSErr; function SASetSleepValue(sleep:integer):integer; function SAFindObject (pt: Point; w: WindowRef): ObjectRef; function InstallFontMenu(menuID:SInt16;var name:Str255;menuHit:MenuHitProc;menuUpdate:MenuUpdateProc):SInt16; procedure SASetStaticText(me:ObjectRef;text:Str255;update:Boolean); function SABeginFullScreen(var port:GrafPtr;backgroundColor:RGBColor):integer; function SAEndFullScreen(port:GrafPtr):integer; function InstallMenu (menuID: integer; var menuTitle: Str255; Hierarchical:Boolean; menuHit: MenuHitProc; menuUpdate: MenuUpdateProc): integer; function InstallResourceMenu (menuID: integer; var menuTitle: Str255; resourceType:OSType; afterItem:integer; menuHit: MenuHitProc; menuUpdate: MenuUpdateProc): integer; procedure SAHideMenuBar; procedure SARestoreMenuBar; procedure _menuBarInit; function SAInitBigArray:integer; function SAGetDynamicArrayHandle(var theArray:ArrayListPtr):Handle; procedure SAGiveTime (suggestedTime: integer); implementation end.